<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates a chdb file</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.chdb-create" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">chdb_create</h1>
  <p class="verinfo">(PECL chdb &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">chdb_create</span> &mdash; <span class="dc-title">Creates a chdb file</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.chdb-create-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>chdb_create</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pathname</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$data</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>chdb_create()</strong></span> creates a chdb file containing the
   specified key-value pairs.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    chdb files are not portable across little-endian and big-endian
    environments. Except for that, they are portable across different
    architectures. Also compatibility across different versions of chdb is not
    guaranteed.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.chdb-create-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">pathname</code></dt>

    <dd>

     <p class="para">
      The name of the file to create.
     </p>
     <p class="para">
       If a file with the same name already exists, it is overwritten.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">data</code></dt>

    <dd>

     <p class="para">
      An array containing the key-value pairs to store in the chdb file.
     </p>
     <p class="para">
      Keys and values are converted to strings before being written to the file,
      as chdb only support the string type. Note that binary strings are
      supported as well, both as keys and values.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.chdb-create-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.chdb-create-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws an exception in case the chdb file hasn&#039;t been successfully created.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.chdb-create-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-5233">
   <p><strong>Example #1 <span class="function"><strong>chdb_create()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$data&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'key1'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'value1'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'key2'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'value2'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #007700">);<br /></span><span style="color: #0000BB">chdb_create</span><span style="color: #007700">(</span><span style="color: #DD0000">'data.chdb'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

   <div class="example-contents"><p>
    The above example will generate a chdb file named
    <em>data.chdb</em> and containing the key-value pairs defined in
    <var class="varname"><var class="varname">$data</var></var>.
   </p></div>
  </div>
 </div>



</div></div></div></body></html>